import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.Vector;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;


public class testKlasseJeMoeder {

	public static void main(String[] args){
		try{ 
			AnnotationfileHandler ah = new AnnotationfileHandler("src/sample/Annotations.xml");
			
			
			ah.writeProperty("border-width", "thick", "Q7_ Q6_ Euro_ Amount. Type");
			
			System.out.println("Location: " + ah.readCCPosition("Purchase Order. Order Line. Purchase Order Line"));
			
			ah.writeCCPosition("Purchase Order. Base Price5. Q3_ Q2_ Euro_ Amount", 7);
			
			ah.saveAnnotationfile("src/sample/Annotations2.xml");
			
			
			
			/*Vector<String> sp = XMLHandler.getAbstractHierarchy("Chocolate_ Food_ Product. Urban_ Reseller_ Customer. Franchise_ Retail_Party");
			Iterator i = sp.iterator();

			while (i.hasNext()){
				System.out.println(i.next());
			}*/




		} catch (Exception e){
			e.printStackTrace();
		} 
	}

	public static Document readFile(String fn) throws IOException, SAXException, ParserConfigurationException {
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();						
		//can not pass directly from filename, use new File():
		return builder.parse(new File(fn));			
	}
}
